-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New async rosapi params module implementation #1001
base: ros2
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good -- no major comments
rosapi/src/rosapi/params.py
Outdated
from rosapi.proxy import get_nodes | ||
|
||
from .async_helper import futures_wait_for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use the fully qualified instead of relative path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
client = _node.create_client( | ||
SetParameters, | ||
f"{node_name}/set_parameters", | ||
callback_group=MutuallyExclusiveCallbackGroup(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you also want this to be reentrant callback group?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for service clients as they are created only for a single service call. In fact, if I understand it correctly, using the default callback group should be also ok here but, just in case I'm wrong, I create unique callback groups for each client.
client = _node.create_client( | ||
GetParameters, | ||
f"{node_name}/get_parameters", | ||
callback_group=MutuallyExclusiveCallbackGroup(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here and onwards
@@ -1,4 +1,5 @@ | |||
string name | |||
string default_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR says that the extra response fields are non-intrusive as you can just ignore them, but removing this default value probably will affect a few users.
I think it makes sense to remove it since you're just getting a parameter, and can handle falling back to a default on the client side, but just pointing out this is another breakage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAIK roslibjs does not use this feature but you're right that it still may affect some users, so I restored this field.
Public API Changes
The
set_param
,get_param
, anddelete_param
service types now include:These changes do not break the compatibility with the current version of
roslibjs
client, as it will ignore these new fields. Additionally, to make it backward compatible, ifget_param
fails, the value field in the response will still be set to an empty JSON string.Description
Changed the implementation of rosapi params module to take advantage of async/await feature of rclpy executor instead of creating a separate node.
Aside from the aforementioned API change, there are few implementation changes:
get_param_names
callslist_parameters
service for each node in parallel, not sequentially. This should make it much more robust, especially if the node graph is quite big.ReentrantCallbackGroup
which means multiple service callbacks can be processed asynchronously.ros2param
cli package are no longer used as they are not awaitable.